package square.data;

import java.util.ArrayList;

import pedrosm.data.ScriptData;



public class DataGroup {

	private static ArrayList<MapData> maps = new ArrayList<MapData>();
	private static ArrayList<SpriteData> sprites = new ArrayList<SpriteData>();
	private static ArrayList<ItemData> items = new ArrayList<ItemData>();
	private static ArrayList<CreatureData> creatures = new ArrayList<CreatureData>();
	private static ArrayList<SkillData> skills = new ArrayList<SkillData>();
	private static ArrayList<ConditionData> conditions = new ArrayList<ConditionData>();
	private static ArrayList<EffectData> effects = new ArrayList<EffectData>();
	private static ArrayList<ScriptData<?>> scripts = new ArrayList<ScriptData<?>>();

	// Map
	public static MapData findMap(String name) {
		for (int i = 0; i < maps.size(); i++) {
			if (maps.get(i).getName().toLowerCase().equals(name.toLowerCase())) {
				return maps.get(i);
			}
		}
		return null;
	}

	// Sprite
	public static SpriteData findSprite(String name) {
		for (int i = 0; i < sprites.size(); i++) {
			if (sprites.get(i).getName().toLowerCase()
					.equals(name.toLowerCase())) {
				return sprites.get(i);
			}
		}
		return null;
	}

	// Item
	public static ItemData findItem(String name) {
		for (int i = 0; i < items.size(); i++) {
			if (items.get(i).getName().toLowerCase().equals(name.toLowerCase())) {
				return items.get(i);
			}
		}
		return null;
	}

	// Creature
	public static CreatureData findCreature(String name) {
		for (int i = 0; i < creatures.size(); i++) {
			if (creatures.get(i).getName().toLowerCase()
					.equals(name.toLowerCase())) {
				return creatures.get(i);
			}
		}
		return null;
	}

	// Effect
	public static EffectData findEffect(String name) {
		for (int i = 0; i < effects.size(); i++) {
			if (effects.get(i).getName().toLowerCase()
					.equals(name.toLowerCase())) {
				return effects.get(i);
			}
		}
		return null;
	}

	// Script
	public static ScriptData<?> findScript(String name) {
		for (int i = 0; i < scripts.size(); i++) {
			if (scripts.get(i).getName().toLowerCase()
					.equals(name.toLowerCase())) {
				return scripts.get(i);
			}
		}
		return null;
	}

	// Skill
	public static SkillData findSkill(String name) {
		for (int i = 0; i < skills.size(); i++) {
			if (skills.get(i).getName().toLowerCase()
					.equals(name.toLowerCase())) {
				return skills.get(i);
			}
		}
		return null;
	}

	// Condition
	public static ConditionData findCondition(String name) {
		for (int i = 0; i < conditions.size(); i++) {
			if (conditions.get(i).getName().toLowerCase()
					.equals(name.toLowerCase())) {
				return conditions.get(i);
			}
		}
		return null;
	}

	// Get & Set
	public static ArrayList<MapData> getMaps() {
		return maps;
	}

	public static void setMaps(ArrayList<MapData> maps) {
		DataGroup.maps = maps;
	}

	public static ArrayList<SpriteData> getSprites() {
		return sprites;
	}

	public static void setSprites(ArrayList<SpriteData> sprites) {
		DataGroup.sprites = sprites;
	}

	public static ArrayList<ItemData> getItems() {
		return items;
	}

	public static void setItems(ArrayList<ItemData> items) {
		DataGroup.items = items;
	}

	public static ArrayList<CreatureData> getCreatures() {
		return creatures;
	}

	public static void setCreatures(ArrayList<CreatureData> creatures) {
		DataGroup.creatures = creatures;
	}

	public static ArrayList<SkillData> getSkills() {
		return skills;
	}

	public static void setSkills(ArrayList<SkillData> skills) {
		DataGroup.skills = skills;
	}

	public static ArrayList<ConditionData> getConditions() {
		return conditions;
	}

	public static void setConditions(ArrayList<ConditionData> conditions) {
		DataGroup.conditions = conditions;
	}

	public static ArrayList<EffectData> getEffects() {
		return effects;
	}

	public static void setEffects(ArrayList<EffectData> effects) {
		DataGroup.effects = effects;
	}

	public static ArrayList<ScriptData<?>> getScripts() {
		return scripts;
	}

	public static void setScripts(ArrayList<ScriptData<?>> scripts) {
		DataGroup.scripts = scripts;
	}
}
